{extends file="admin/base2.html"}
{block name="content"}
        <div class="x-body">
            <form action="index.php?c=admin&a=artUpdate" method="post" class="layui-form layui-form-pane">
               <input type="hidden" name="id" required lay-verify="id" value="{$art.id}" 
                        autocomplete="off" class="layui-input">
                <div class="layui-form-item">
                    <label for="L_title" class="layui-form-label">
                        标题
                    </label>
                    <div class="layui-input-block">
                        <input type="text" id="L_title" name="title" required lay-verify="title" value="{$art.title}" 
                        autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_title" class="layui-form-label">
                        摘要
                    </label>
                    <div class="layui-input-block">
                        <input type="text" id="L_title" name="abstract" required lay-verify="title" value="{$art.abstract}" 
                        autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_title" class="layui-form-label">
                       关键字
                    </label>
                    <div class="layui-input-block">
                        <input type="text" id="L_title" name="keyword" value="{$art.keyword}" required lay-verify="title"
                        autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <div class="layui-input-block">
                        <textarea id="L_content" name="content" 
                        placeholder="请输入内容" class="layui-textarea fly-editor" style="height: 260px;">{$art.content}</textarea>
                    </div>
                    <label for="L_content" class="layui-form-label" style="top: -2px;">
                        描述
                    </label>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">
                            所在类别
                        </label>
                        <div class="layui-input-block">
                            <select lay-verify="required" name="kid">
                                <option>
                                </option>
                                <option value="1" {if $art.kid eq '1'}selected{/if}>琐言碎语</option>
                                <option value="2" {if $art.kid eq '2'}selected{/if}>get新技能</option>
                                <option value="3" {if $art.kid eq '3'}selected{/if}>作品云集</option>  <option value="4" {if $art.kid eq '4'}selected{/if}>情感日记</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">
                            所属标签
                        </label>
                        <div class="layui-input-block">
                            <select lay-verify="required" name="tid">
                                <option>
                                </option>
                                <optgroup label="技术相关">
                                    <option value="1" {if $art.tid eq '1'}selected{/if} >PHP</option>
                                    <option value="2" {if $art.tid eq '2'}selected{/if}>HTML5</option>
                                    <option value="3" {if $art.tid eq '3'}selected{/if}>js</option>
                                </optgroup>
                                <optgroup label="生活杂谈">
                                    <option value="100" {if $art.tid eq '100'}selected{/if}></option>
                                    <option value="101" {if $art.tid eq '101'}selected{/if}>我的大学</option>
                                    <option value="102" {if $art.tid eq '102'}selected{/if}>生活感悟</option>
                                </optgroup>
                            </select>
                        </div>
                    </div>
                </div>
               
                <div class="layui-form-item">
                    <button class="layui-btn" lay-filter="add" lay-submit>
                        保存
                    </button>
                </div>
            </form>
        </div>
{/block}
{block name="js"}
    {literal}
        <script>
            layui.use(['form','layer','layedit'], function(){
                $ = layui.jquery;
              var form = layui.form()
              ,layer = layui.layer
              ,layedit = layui.layedit;


                layedit.set({
                  uploadImage: {
                    url: "./upimg.json" //接口url
                    ,type: 'post' //默认post
                  }
                })
  
            //创建一个编辑器
            editIndex = layedit.build('L_content');
            
              

              //监听提交
              // form.on('submit(add)', function(data){
              //   //console.log(data.field);
              //   //发异步，把数据提交给php               
              //   $.get("index.php?c=admin&a=artUpdate",{id:2,title:234},function(d){

              //           console.log(d);
              //       //在ajax的回调函数中将结果放到表单中
              //           // if (d>0) {
              //           //     layer.alert("保存成功", {icon: 6});//,function () {
              //           //         // 获得frame索引
              //           //         //var index = parent.layer.getFrameIndex(window.name);
              //           //         //关闭当前frame
              //           //         //parent.layer.close(index);
              //           //     //});
              //           // }else{
              //           //     layer.alert("保存失败", {icon: 6});
              //           // }
                        
              //       },"json");


                
              //   return false;
              // });
              
            });
        </script>
       {/literal}
{/block}